<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>

        function getDelayPromise(duration) {
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    resolve();
                }, duration);
            })
        }

        async function biaobai(god) {
            console.log(`邓哥向${god}发出了表白短信`);
            await getDelayPromise(500);            // 函数运行到这，等待500ms，后面为异步代码，
            return Math.random() < 0.3;
        }


    </script>
</body>

</html>